#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using pii = pair < int , int >;
using vec = vector < int >;
using veg = vector < pii >;
using ll = long long;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

bool isf(int x) {
	rep(i, 2, x) {
		if(i * i > x) break;
		if(x % i == 0) return 0;
	} return 1;
}

int calc(int x, ll t) {
	int res = 0;
	rep(i, 2, x) {
		if(i * i > x) break;
		if(x % i == 0){
			if(isf(i)) {
				if(t % i) res++;
			}
			if(i * i != x && isf(x / i)) {
				if(t % (x / i)) res++;
			}
		}
	}
	if(isf(x)) if(t % x) res++; return res;
}

void solve() {
	ll n; cin >> n;
	ll x1 = 0, x2 = 0;
	rep(i, 2, 1000) if(calc(i + 1, n) == calc(i, n)) return cout << i * n + n << " " << i * n << endl, void();
	assert(0);
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
    int t; cin >> t;
	while(t--) solve();
}
